package com.breeze.utils;

public class LinkedListUtil {
    public static void show(ListNode head) {
        while (head != null) {
            System.out.print(head.val + ",");
            head = head.next;
        }
    }

    public static ListNode get(int... elements) {
        if (elements.length < 1) {
            return null;
        }
        ListNode head = new ListNode(elements[0]);
        ListNode temp = head;
        for (int i = 1; i < elements.length; i++) {
            temp.next = new ListNode(elements[i]);
            temp = temp.next;
        }
        return head;
    }
}
